package org.codeart.pattern.flyweight.ticket;

import java.util.Random;

public class TrainTicket implements ITicket {

    private final String from;

    private final String to;

    private int price;

    public TrainTicket(String from, String to) {
        this.from = from;
        this.to = to;
    }

    @Override
    public void showInfo(String bunk) {
        this.price = new Random().nextInt(500);
        System.out.printf("%s -> %s: %s 价格: %s 元%n", this.from, this.to, bunk, this.price);
    }
}
